package collection;

import java.util.ArrayList;
import java.util.Collection;

public class CollectionOperDemo {
    public static void main(String[] args) {
        Collection C1 = new ArrayList();
        C1.add("JAVA");
        C1.add("C++");
        C1.add(".NET");
        System.out.println("C1"+C1);

        Collection C2 = new ArrayList();
        C2.add("android");
        C2.add("ios");
        C2.add("java");
        System.out.println("C2"+C2);

        C1.addAll(C2);
        System.out.println("C2"+C2);
        System.out.println("C1"+C1);

        Collection c3 = new ArrayList();
        c3.add("c++");
        c3.add("anderoid");
        c3.add("php");
        System.out.println("C3"+c3);

        boolean contains = C1.containsAll(c3);
        System.out.println("是否包含："+contains);
        //取出交集
//        C1.retainAll(c3);
//        System.out.println("C3"+c3);
//        System.out.println("C1"+C1);

        //删交集
        C1.removeAll(c3);
        System.out.println("C3"+c3);
        System.out.println("C1"+C1);











    }
}
